package com.example.demo.controller;

import com.example.demo.common.AppResult;
import com.example.demo.exception.ApplicationException;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Api(tags = "测试类的相关接口")
public class TestController {

    @GetMapping("/exception")
    public AppResult testException() throws Exception {
        throw new Exception("这是一个 Exception ...");
    }

    @GetMapping("/appException")
    public AppResult testApplicationException() {
        throw new ApplicationException("这是一个ApplicationException...");
    }
}
